<?php

namespace App\Remote\XiaoKe;

use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;

class UserRemote extends Remote
{
    /**
     * 客户列表
     *
     * @param int $pageNum
     * @param int $pageSize
     * @return mixed
     * @throws GuzzleException
     * @throws ValidationException
     */
    public static function list(int $pageNum = 1, int $pageSize = 50)
    {
        return self::customRequestV3(
            "/api/services/1_0/rest/user/listByPage",
            RequestAlias::METHOD_POST,
            [
                "pid"      => self::getPid(),
                "pageNum"  => $pageNum,
                "pageSize" => $pageSize
            ],
            null,
            null,
            0,
            true
        );
    }


    /**
     * 获取客户详情
     *
     * @param string $key
     * @return mixed
     * @throws GuzzleException
     * @throws ValidationException
     */
    public static function detail(string $key)
    {
        return self::customRequestV3(
            "/api/services/1_0/rest/customer/detail",
            RequestAlias::METHOD_POST,
            [
                "wid" => self::getWid(),
                "pid" => self::getPid(),
                "key" => $key
            ],
            null,
            null,
            0,
            true
        );
    }
}
